package com.example.designpatterns.chain;

/**
 * ErrorHandler类 - 处理ERROR类型的请求
 */
public class ErrorHandler extends Handler {
    
    public ErrorHandler() {
        super("错误处理器");
    }
    
    @Override
    protected boolean canHandle(Request request) {
        return request.getType() == Request.RequestType.ERROR;
    }
    
    @Override
    protected void doHandle(Request request) {
        System.out.println("错误处理器处理请求: " + request.getMessage());
        System.out.println("错误已记录，触发警报，通知开发团队和运维人员");
        request.setHandled(true);
    }
} 